package company.sougou;

public class Sou2 {
    public int getHouses(int t, int[] xa) {
        int count = 2;
        int n = xa.length;
        int ans = 0;
        for (int i = 0; i < n - 2; i += 2) {
            ans = xa[i + 2] - xa[i] - (xa[i + 1] + xa[i + 3]) / 2;
            if (ans > t)
                count += 2;
            if (ans == t)
                count += 1;
        }
        return count;
    }
}
